#pragma once
#include<iostream>
#include<string>
using namespace std;
namespace ww
{
	template<class Iterator, class Ref, class Ptr>
	struct __reserve_iterator
	{
		typedef __reserve_iterator<Iterator, Ref, Ptr> Riterator;

		__reserve_iterator(Iterator it)
			:_cur(it)
		{}

		Riterator operator++()
		{
			--_cur;
			return *this;
		}

		Riterator operator++(int)
		{
			Iterator tmp(*this);
			--_cur;
			return tmp;
		}

		Ref operator*()
		{
			Iterator tmp = _cur;
			return *--tmp;
		}

		Riterator operator--()
		{
			++_cur;
			return *this;
		}

		Riterator operator--(int)
		{
			Iterator tmp(*this);
			++_cur;
			return tmp;
		}

		Ptr operator->()
		{
			return &(operator*());
		}

		bool operator!=(const Riterator it)const
		{
			return _cur != it._cur;
		}

		bool operator==(const Riterator it)const
		{
			return _cur == it._cur;
		}


		Iterator _cur;
	};
}
